import request from "@/utils/request";
import { useUserStore } from '@/stores/user';
const getToken = () => {
    const userStore = useUserStore();
    return userStore.token;
};
//商品分类接口
export const getCategoryList = () => {
  return request.get("/products/catagory");
};

//商品分类详细列表接口
export const getCategoryDetail = (id) => {
  return request.post("/products/Classify?catagoryId=" + id);
};

//用户购物车接口
export const getCartList = () =>
  request.get('/cart/list',{
  headers: {
    'Authorization': getToken() // 获取用户 token
}
});
//删除购物车商品接口
export const deleteCartItem = (productId) =>
  request.delete(`/cart/delete/${productId}`, {
    headers: {
      'Authorization': getToken() // 获取用户 token
    }
  });
